/* Copyright (C) 
 * 
 * 声明
 * 本程序是苏州思必驰信息科技有限公司的财产,思必驰公司对其内容拥有完全知识产权。
 * 其源代码仅提供给授权的相关人士作为参考。在未得到苏州思必驰信息科技有限公司的
 * 书面许可之前,任何人不得向其他人、组织透露其中任何细节。如果您不确认您是否属于
 * 被授权的人士,请在阅读本源码前联络 info@aispeech.com。
 * 
 * Disclaim
 * This program is the property of AI Speech Ltd. It shall be communicated to
 * authorized personnel only. It is not to be disclosed outside the group without
 * prior written consent. If you are not sure if you’re authorized to read this
 * program, please contact info@aispeech.com before reading.
 * 
 */

/**
 * @file wtk_utils_debug.h
 * 
 * @brief macro used for output debug information
 *
 * there are two relate macro
 * - WTK_DEV_DEBUG: if define, output debug information
 * - WTK_CLR_PRINT: only works while define with WTK_DEV_DEBUG, output debug informaton in 
 *   different color, according their level
 * 
 * @author wxm71(weixing.mei@aispeech.com)
 * 
 * @version 0.0.1
 * 
 * @date 2014-07-29
 */

#ifndef ___WXM71___WTK_WTK_UTILS_DEBUG__HEADER___
#define ___WXM71___WTK_WTK_UTILS_DEBUG__HEADER___

#ifdef __cplusplus 
extern "C" {
#endif 

#include <time.h>

// used for android debug
#ifdef __ANDROID__
#include <android/log.h>
// #define printf(f, ...) __android_log_print(ANDROID_LOG_DEBUG, "wtk_log", f, ##__VA_ARGS__)
#endif


void wtk_utils_log_print(int clr, const char *flag,  const char *file, const char *func, int lineno, char *fmt, ...);

// always output error 
#define wtk_utils_error(FMT, ...) wtk_utils_log_print(31, "ERROR", __FILE__, __FUNCTION__, __LINE__, FMT, ##__VA_ARGS__)


#ifdef WTK_DEV_DEBUG
#   define wtk_utils_warn(FMT, ...) wtk_utils_log_print(33, "WARN", __FILE__, __FUNCTION__, __LINE__, FMT, ##__VA_ARGS__)
#   define wtk_utils_debug(FMT, ...) wtk_utils_log_print(32, "DEBUG", __FILE__, __FUNCTION__, __LINE__, FMT, ##__VA_ARGS__)
#   define wtk_utils_info(FMT, ...) wtk_utils_log_print(34, "INFO", __FILE__, __FUNCTION__, __LINE__, FMT, ##__VA_ARGS__)
#else
#   define wtk_utils_warn(...) 
#   define wtk_utils_debug(...) 
#   define wtk_utils_info(...)
#endif


#ifdef __cplusplus  
};
#endif

#endif
